W razie problemów technicznych ze Szkopułem, prosimy o kontakt mailowy pod adresem [email protected].
Jeśli chciałbyś porozmawiać o zadaniach, rozwiązaniach lub problemach technicznych, zapraszamy na serwery Discord. Są one moderowane przez społeczność, ale członkowie zespołu technicznego też są tam aktywni.
As a punishment for misbehaving, Byteasar is to calculate a certain mysterious and nasty Boolean-valued function , which is defined for a pair of positive integer sequences , as follows:
boolean
if then returnWhere:
Write a programme that reads several pairs of sequences from the standard input and prints out the values on the standard output for every input pair.
The first line of the standard input contains one integer () denoting the number of sequence pairs to analyse. Next line hold descriptions of test cases. The first line of each description contains two integers and () separated by a single space and denoting the lengths of the first and second sequence, respectively. The second line holds integers () that form the sequence , separated by single spaces. The third line holds integers (), that form the sequence , separated by single spaces.
The output should consist of exactly lines; the -th line (for ) should contain a single integer - 0 or 1 - the value of for -th test case.
For the input data:
2 4 5 3 1 2 1 1 3 1 2 1 7 7 1 1 2 1 2 1 3 1 1 2 1 3 1 3
the correct result is:
0 1
Task authors: Jakub Radoszewski and Wojciech Rytter.